package com.bt.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bt.mapper.DtsFootprintMapper;
import com.bt.pojo.DtsFootprint;
import com.bt.service.DtsFootprintService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author wbt
 * @version v1.0
 * @project shop_manage
 * @data 2022/9/24 19:18
 **/
@Service
public class DtsFootprintServiceImpl implements DtsFootprintService {
    @Autowired
    private DtsFootprintMapper dtsFootprintMapper;
    @Override
    public IPage<DtsFootprint> findFootprintByPage(Integer page, Integer limit, Integer userId, Integer goodsId, String sort, String order) {
        return dtsFootprintMapper.selectPage(new Page<DtsFootprint>(page,limit),new QueryWrapper<DtsFootprint>().eq(userId!=null,"user_id",userId).eq(goodsId!=null,"goods_id",goodsId).orderByDesc(sort!=null,sort));
    }
}
